home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
dviware
/
dvi2pcl
/
rotatechar.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-24
|
1KB
|
52 lines
/*
* Rotate the pixel pattern, stored in pxlbuffer by 90 degrees for landscape
* printout mode. The rotated pixel pattern starts at the end of the
* original pixel pattern in pxlbuffer. The pointer to the begin of the
* rotated pattern is returned by rotatechar()
*/
#include "globals.h"
byte *rotatechar()
{
int lbit, tbit;
int width, height, bytes, length;
int mask;
byte *pp, *lp, *tp;
register int i,j;
width = c_height;
height = c_width;
bytes = (height + 7) / 8;
length = height*((width + 7)/8);
if(endofchardata - pxlbuffer + length >= MAXPXLSIZE)
prerror("Out of memory while rotating character\n");
lp = endofchardata;
for(i = 0 ; i < length ; i++)
*lp++ = 0;
lp = endofchardata - 1;
tp = pxlbuffer - 1;
tbit = 7 - (height -1) % 8;
for(i = 0 ; i < height; i++) {
if(tbit == 8) {
tbit = 0;
tp--;
}
pp = tp + bytes;
mask = power[tbit++];
lp++;
lbit = 8;
for(j = 0 ; j < width ; j++) {
if(!lbit--) {
lbit = 7;
lp++;
}
if(*pp & mask)
*lp |= power[lbit];
pp += bytes;
}
}
return(endofchardata);
}